﻿using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.ObjectBuilder;

namespace Lilium.Unity.ContainerConfiguration
{
	/// <summary>
	/// Used to reflect configuration during build planning process.
	/// </summary>
	public sealed class ConfigurationReflectionExtension: UnityContainerExtension
	{
		protected override void Initialize()
		{
            Context.Policies.SetDefault(typeof(IContainerConfigurationPolicy), new ConfigurationReflectionPolicy(Container));
			
			Context.BuildPlanStrategies.AddNew<ContainerConfigurationStrategy>(UnityBuildStage.PreCreation);
		}
	}
}